package com.laikan.reader.core.utils;

import android.app.Activity;
import android.view.KeyEvent;
import android.widget.Toast;
import com.laikan.library.components.dialog.BaseDialog;
import com.laikan.reader.R;

/**
 * 加载框
 */
public class ReaderViewLoadingDialog extends BaseDialog {

    //	private TextView tvShowText;
    private long mkeyTime;

    public ReaderViewLoadingDialog(Activity activity) {
        super(activity, R.layout.loading_dialog, R.style.LaikanTheme_Dialog_Loading);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            if ((System.currentTimeMillis() - mkeyTime) > 2000) {
                mkeyTime = System.currentTimeMillis();
                Toast.makeText(this.getContext(), "再按一次退出加载", Toast.LENGTH_SHORT).show();
            }else {
                this.dismiss();
            }
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

    @Override
    protected void initView() {
        //		tvShowText = (TextView) findViewById(R.id.tvShowText);

    }

    @Override
    protected void initData() {
        //		tvShowText.setText("加载中...");

    }

    @Override
    protected void setListener() {

    }

    public void setShowText(int resId) {
        //		tvShowText.setText(resId);
    }

    public void setShowText(String showText) {
        //		tvShowText.setText(showText);
    }

}
